<template>
  <div id="class-three-rule"></div>
</template>

<script>
import echarts from '../../lib/echarts'

export default {
  name: "DataAnalyzeClassroom",
  components: {},
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {
  },
  mounted() {
    this.getRuleData()
  },
  methods: {
    getRuleData() {
      var myChart = echarts.init(document.getElementById('class-three-rule'), 'light');
      var option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {            // 坐标轴指示器，坐标轴触发有效
            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
          }
        },
        legend: {
          data: ['课堂记录', '提问次数', '学生专注度']
        },
        grid: {
          left: '4%',
          right: '4%',
          bottom: '2%',
          containLabel: true
        },
        xAxis: [
          {
            type: 'value',
            // 轴线文字
            axisLabel: {
              show: true,
              textStyle: {
                color: "#2479ff",
                lineHeight: 26
              }
            },
            // 刻度
            axisTick: {
              show: true,
              length: 3,
              lineStyle: {
                width: 1,
                type: "solid"
              }
            },
            // 轴线的颜色以及宽度
            axisLine: {
              show: true,
              lineStyle: {
                color: "#2479ff",
                width: 1,
                type: "solid"
              }
            },
          }
        ],
        yAxis: [
          {
            type: 'category',
            axisTick: {
              show: false
            },
            // 轴线文字
            axisLabel: {
              show: true,
              textStyle: {
                color: "#2479ff",
              }
            },
            data: ['语文', '化学', '数学', '生物', '历史', '英语', '计算机']
          }
        ],
        series: [
          {
            name: '课堂记录',
            type: 'bar',
            label: {
              show: true,
              position: 'inside'
            },
            data: [-10, -8, -7, -8, -5, -9, -1]
          },
          {
            name: '学生专注度',
            type: 'bar',
            stack: '课堂质量',
            label: {
              show: true
            },
            data: [-7, -5, -10, -1, -9, -2, -4]
          },
          {
            name: '提问次数',
            type: 'bar',
            stack: '课堂质量',
            label: {
              show: true,
            },
            data: [20, 2, 1, 7, 9, 5, 20]
          }
        ]
      };

      myChart.setOption(option)
    }
  }
}
</script>

<style scoped>
#class-three-rule {
  width: 100%;
  height: 100%;
}
</style>
